// Count组件
import React from 'react'
import { useSelector, useDispatch } from 'react-redux'
import { add, asyncAdd } from './redux/actions'
export default function Count() {
  const count = useSelector((state) => {
    return state.zs.count
  })

  const dispatch = useDispatch()

  return (
    <div>
      <p>{count}</p>
      <button
        onClick={() => {
          dispatch(add(8))
        }}
      >
        +
      </button>
      <button
        onClick={() => {
          dispatch(asyncAdd(6))
        }}
      >
        async +
      </button>
    </div>
  )
}
